import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class HomeAppBar extends StatelessWidget implements PreferredSizeWidget {


  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 750, height: 1334);
    return Container(
      color: Colors.red,
      child: Container(
        padding: EdgeInsets.only(top: ScreenUtil.statusBarHeight),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            Container(
              width: 150.w,
              child: Row(
                children: <Widget>[
                  Icon(Icons.location_on, size: 20, color: Colors.white),
                  Text(
                    '淮南市区',
                    style: TextStyle(fontSize: 22.sp,color: Colors.white),
                  ),
                ],
              ),
            ),
            SizedBox(width: 20.w),
            InkWell(
              child: Container(
                width: 450.w,
                height: 68.h,
                decoration: BoxDecoration(
                    color: Color.fromRGBO(233, 233, 233, 0.8),
                    borderRadius: BorderRadius.circular(30)),
                padding: EdgeInsets.only(left: 10),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    Icon(Icons.search, color: Colors.black38),
                    SizedBox(width: 40.w),
                    Text("华为P40",
                        style:
                            TextStyle(fontSize: 30.sp, color: Colors.black38))
                  ],
                ),
              ),
              onTap: () {
//          Navigator.pushNamed(context, '/search');
              },
            ),
            IconButton(
              icon: Stack(
                children: <Widget>[
                  Icon(Icons.add_alert, size: 28, color: Colors.white),
                  Positioned(
                    left: 10,
                    top: 3,
                    child: Container(
                      width: 18,
                      height: 18,
                      decoration: BoxDecoration(
                          color: Colors.red,
                          border: Border.all(color: Colors.white),
                          borderRadius: BorderRadius.all(Radius.circular(20))),
                      child: Center(
                        child: Text(
                          '6',
                          style: TextStyle(fontSize: 12,color: Colors.white),
                        ),
                      ),
                    ),
                  ),
                ],
              ),
              onPressed: () {
//            Navigator.pushNamed(context, '/conversation_list');
              },
            )
          ],
        ),
      ),
    );
  }

  @override
  Size get preferredSize => Size.fromHeight(68.0);
}
